/*
 * To change this template, choose Tools | Templates
 * and open the template in the editor.
 */
package apirose;

import apirose.APIEtudiant;
import java.sql.ResultSet;
import java.sql.SQLException;
import java.util.ArrayList;
import java.util.logging.Level;
import java.util.logging.Logger;

/**
 *
 * @author v-tech_master
 */
public class Etudiant_MySQL implements APIEtudiant {
    
    private Request_MySQL bdd;

    Etudiant_MySQL(Request_MySQL request) {
        this.bdd = request;
    }

    public ArrayList<Integer> getIdUESuivitBDD(int idEtudiant) {
        ArrayList<Integer> listeId = new ArrayList<Integer>();
        String req = "SELECT idUE FROM Inscription "
                       + "WHERE idEtudiant = "+idEtudiant+";";
        
        ResultSet rs = bdd.executer_requete(req);
        try {
            while(rs.next()){
                listeId.add(rs.getInt("idUE"));
            }
        } catch (SQLException ex) {
            Logger.getLogger(Etudiant_MySQL.class.getName()).log(Level.SEVERE, null, ex);
        }
        
        return listeId;
    }
    
}
